summaryrefslogtreecommitdiff
path: root/app/[lng]/evcp/(evcp)/(sales)/budgetary-tech-sales-top/page.tsx
blob: 0949d9a0ad20ff38e3b2778418ff6e3cc2c5f75f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { searchParamsTopCache } from "@/lib/techsales-rfq/validations"
import { getTechSalesTopRfqsWithJoin } from "@/lib/techsales-rfq/service"
import { getValidFilters } from "@/lib/data-table"
import { Shell } from "@/components/shell"
import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton"
import { RFQListTable } from "@/lib/techsales-rfq/table/rfq-table"
import { type SearchParams } from "@/types/table"
import * as React from "react"
import { InformationButton } from "@/components/information/information-button"
import { useTranslation } from "@/i18n"
interface HullRfqPageProps {
  params: Promise<{lng: string}>
  searchParams: Promise<SearchParams>
}

export default async function HullRfqPage(props: HullRfqPageProps) {
  // searchParams를 await하여 resolve
  const searchParams = await props.searchParams
  const {lng} = await props.params
  const {t} = await useTranslation(lng, 'menu')
  // 해양 TOP용 파라미터 파싱
  const search = searchParamsTopCache.parse(searchParams);
  const validFilters = getValidFilters(search.filters);
  
  // 기술영업 해양 TOP RFQ 데이터를 Promise.all로 감싸서 전달
  const promises = Promise.all([
    getTechSalesTopRfqsWithJoin({
      ...search, // 모든 파라미터 전달 (page, perPage, sort, basicFilters, filters 등)
      filters: validFilters, // 고급 필터를 명시적으로 오버라이드 (파싱된 버전)
    })
  ])

  return (
    <Shell variant="fullscreen" className="h-full"> {/* fullscreen variant 사용 */}
      {/* 고정 헤더 영역 */}
      <div className="flex-shrink-0">
        <div className="flex items-center justify-between">
          <div>
            <div className="flex items-center gap-2">
              <h2 className="text-2xl font-bold tracking-tight">
                {t('menu.tech_sales.budgetary_top')}
              </h2>
              <InformationButton pagePath="evcp/budgetary-tech-sales-top" />
            </div>
          </div>
        </div>
      </div>

      {/* 테이블 영역 - 남은 공간 모두 차지 */}
      <div className="flex-1 min-h-0">
        <React.Suspense
          fallback={
            <DataTableSkeleton
              columnCount={8}
              searchableColumnCount={2}
              filterableColumnCount={3}
              cellWidths={["10rem", "15rem", "12rem", "12rem", "8rem", "8rem", "10rem", "8rem"]}
              shrinkZero
            />
          }
        >
          <RFQListTable promises={promises} className="h-full" rfqType="TOP" />
        </React.Suspense>
      </div>
    </Shell>
  )
}